Skip to content

Conversation

@halo
Copy link

@halo halo commented Nov 5, 2025

Using --fatal-deprecation 1.93.3 causes unrelated warnings:

Warning: mixed-decls deprecation is obsolete, so does not need to be made fatal.
Warning: type-function deprecation is obsolete, so does not need to be made fatal.

I think it is because Depdecation.forVersion does not filter out deprecations that have been marked as obsoleteIn.

This is my attempt to solve it. I hope I don't have to sign the Google Individual Contributor License Agreement, because I don't use a Google Account (I see no way to sign the agreement without an account, though I'm fine with agreeing to its contents, although my code is just a single conditional and the obvious related test). Also, the newly added test passes, and the grinder linted my code (as far as I can tell), but I could not run the -x node tests for some reason.

If this is unacceptable feel free to close this PR. It was a nice exercise learning something about Dart! Thank you for your time.

PS: This project is so well maintained and I'm grateful to @nex3 who kept in in shape for years and put so much effort in documentation and figuring out a path to go forward with the SASS syntax as CSS evolves more and more. Thank you!

Related: #2647

Copy link
Member

@jathak jathak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch with this! --fatal-deprecation <version> should definitely not make deprecations that were obsolete as of <version> fatal.

However, I actually think it makes more sense to exclude all deprecations that are obsolete in the currently running version from --fatal-deprecation, even if they weren't yet obsolete in the <version> passed to the flag.

If for instance, --fatal-deprecation 1.91.0 was added to a user's config when 1.91.0 was the current version, it makes sense for the flag to continue to work without warnings in 1.92.0 when mixed-decls and type-function are obsoleted without the user having to bump the fatal version to 1.92.0, which would additionally make with-private fatal.

@halo halo force-pushed the no-fatal-obsolete-warnings branch from 22d85c6 to 50d51ac Compare November 11, 2025 20:21
/// Returns the set of all deprecations done in or before [version].
static Set<Deprecation> forVersion(Version version) {
var range = VersionRange(max: version, includeMax: true);
static Set<Deprecation> forVersion(Version version, [Version? current]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comparison to the current version is not necessary here. This should just exclude any deprecation where obsoleteIn is non-null

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xzMs8O1KQh17i

@halo
Copy link
Author

halo commented Nov 11, 2025

I admit I had to read your last paragraph 5 times before it finally sank in 😆 You are perfectly right.

The tests are somewhat lacking, because I don't know how stub the obsoletion data or sass version numbers.

(Edit: Sorry for all the --force. But I think I should have it now. Again 😄)

@halo halo force-pushed the no-fatal-obsolete-warnings branch 3 times, most recently from e2037a6 to 206e0b6 Compare November 11, 2025 20:50
@halo halo marked this pull request as ready for review November 11, 2025 20:50
@halo halo force-pushed the no-fatal-obsolete-warnings branch from 206e0b6 to 0a4d0fc Compare November 11, 2025 20:53
Copy link
Member

@jathak jathak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you bump the minor versions of the packages and add changelog entries so we can release this fix? (see here for instructions)

final version = Version.parse('1.79.0');
final deprecations = Deprecation.forVersion(version);

expect(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just check that a couple of the currently obsolete deprecations are excluded here. We use deprecations.yaml in the language repo as a single-source of truth for the current list of deprecations and don't want to have to manually update the list anywhere else.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. I added two regression tests now (so that I don't break the current functionality) and one test for the intended fix (excluding obsolete deprecations).

@halo halo force-pushed the no-fatal-obsolete-warnings branch from 0a4d0fc to 6fa7456 Compare November 12, 2025 06:58
Using `--fatal-deprecation 1.92.0` would emit: "Warning: mixed-decls
deprecation is obsolete, so does not need to be made fatal".
This commit avoids these warnings by excluding obsolete deprecations.
See also sass#2647
@halo halo force-pushed the no-fatal-obsolete-warnings branch from 6fa7456 to 44eb3fd Compare November 12, 2025 07:10
@@ -1,3 +1,7 @@
## 16.0.2

* No user-visible changes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about this (whether this is the Dart API or the JS API or both and if they were affected or not).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants